public class Test {
    public static void main(String[] args) {
              MyBlockQueue myBlockQueue=new MyBlockQueue();

              Thread thread1=new Thread(()->{
                  int count=0;
                while(true){
                    myBlockQueue.put(count);
                    System.out.println("生产元素："+count);
                    count++;
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }

                }
              });

              Thread thread2=new Thread(()->{

                  while (true){

                     int a= myBlockQueue.take();
                      System.out.println("消费元素："+a);
                  }
              });

              thread1.start();
              thread2.start();
    }
}
